/**$Licence:
 *   Use this however/wherever you like, just don't blame me if it breaks anything.
 *   Copyright (C) 2008 - 2012 xingsheng.zhu@gmail.com All rights reserved.
 */
package com.blazemina.config;

import java.io.Serializable;

/**
 * @author JackChu
 * @version 1.0.0 2012-1-16 下午5:07:42
 */
public abstract class BaseConfig implements Serializable {
	 /**
     * Indicates if configuration of this component been completed. TODO
     * change protected to private and use methods provided by extenders?
     */
    protected boolean configured = false;
    
    /**
     * Throw <code>IllegalStateException</code> if configuration is frozen.
     *
     * @throws IllegalStateException if configuration is frozen
     */
    public void throwIfConfigured() {
        if (configured) {
            throw new IllegalStateException("Configuration is frozen");
        }
    }
    
    /**
     * Freeze the configuration of this action.
     */
    public void freeze() {
        configured = true;
    }

}
